#include <stdio.h>
// 根据输入的月份和年份，求出该月的天数（1-12）, 就是需要考虑闰年（2月份 29）和平年（2月份 28）。
int main()
{
  int year, month;
  printf("请输入一个年份数：");
  scanf("%d", &year);
  printf("请输入一个月份数：");
  scanf("%d", &month);
  if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
  {
    switch (month)
    {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
      printf("%d年的%d月有31天\n", year, month);
      break;
    case 4:
    case 6:
    case 9:
    case 11:
      printf("%d年的%d月有30天\n", year, month);
      break;
    case 2:
      printf("%d年是闰年，所以%d月有29天\n", year, month);
      break;
    default:
      printf("输入错误！\n");
    }
  }
  else
  {
    switch (month)
    {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
      printf("%d年的%d月有31天\n", year, month);
      break;
    case 4:
    case 6:
    case 9:
    case 11:
      printf("%d年的%d月有30天\n", year, month);
      break;
    case 2:
      printf("%d年是平年，所以%d月有28天\n", year, month);
      break;
    default:
      printf("输入错误！\n");
    }
  }
  return 0;
}